/**
 * Created On: Jul 28, 2012
 */
package org.rvk.vms.utils;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

/**
 * General String Utilities.
 * 
 * @author Ashish Kumar Sinha <aksinha.mail@gmail.com>
 * Version 1.0
 */
@Service("stringUtils")
@Scope((BeanDefinition.SCOPE_SINGLETON))
public class StringUtils {
	
	/**
	 * to test if the specified String value is blank.
	 * 
	 * A string is blank if
	 * 1. it is null
	 * 2. only contains white spaces.
	 * 
	 * @param value - the string under scan
	 * @return true if the input string is blank, false otherwise.
	 */
	public boolean isBlank(String value){
		return (value == null) || (value.trim().isEmpty());
	}
	
	/**
	 * to test if the specified String value is not blank.
	 * 
	 * Basically, it is compliment of {@link #isBlank(String)}.
	 * @param value - the specified  string value to be tasted
	 * @return compliment of {@link #isBlank(String)}
	 */
	public boolean isNotBlank(String value) {
		return !isBlank(value);
	}
}
